cmake_minimum_required(VERSION 3.10)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
include_directories(${TASKBUS_INTERFACEDIR})
set(PRJ_SOURCES
	main.cpp
	uhd_io.cpp
	uhd_thread.cpp
	resources.qrc
)

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
	include_directories($ENV{UHD_PKG_PATH}/include)
	link_directories($ENV{UHD_PKG_PATH}/lib)
endif()
#############Target======================

add_executable(uhd_usrp_io
	${PRJ_SOURCES}
)
target_link_libraries(uhd_usrp_io
	Qt${QT_VERSION_MAJOR}::Core
	uhd
	${TBLinkExtra}
)

# ====copy doc
add_custom_command(TARGET uhd_usrp_io
		 POST_BUILD
		 COMMAND echo Copy Handbook to EXE path
		 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/readme.md ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/uhd_usrp_io.md
	 )

